Xbasic

SQL::ResultSetToDBF Method

Syntax

Result as L = ToDBF(FileName as C [, EventScript = as C [, Rows = -1 as N [, StartRow = -1 as N [, Append = .t. as L [, DictionaryName = as C [, MapByPosition = .f. as L [, TableInfo as SQL::TableInfo]]]]]]])

Arguments

FileNameCharacter

The path and filename of the Alpha Anywhere table.

EventScriptCharacter

Default = "". An Xbasic Script implementing any of the following functions. In each case, the Context argument is the connection itself.

UpdateBegin()
UpdateProgress()
UpdateEnd()
RowsNumeric

Default = -1 (all). The number of rows to copy.

StartRowNumeric

Default = -1 (first row). The first row to copy.

AppendLogical

Default = .t.. Whether to overwrite the existing data.

DictionaryNameCharacter

Default = "". Internal use only.

MapByPositionLogical

Default = .f.. Maps by position.

TableInfoSQL::TableInfo

Default = null_value(). Table info.

Returns

ResultLogical

Returns .t. if successful. Otherwise .f..

Description

Create a local copy of the result set in a .DBF table

Discussion

The SQL::ResultSet.ToDBF() method fetches rows to a new or overwritten local DBF table.

Example

dim conn as SQL::Connection
dim sql as C
dim country as C
dim args as SQL::Arguments
dim cs as C
dim rs as SQL::ResultSet
cs = "::Name::AADemo-Northwind"
country = ui_get_text("Country", "Show Companies in what country?")
sql = "select contactname from customers where country = :country"
if .not. conn.open(cs)
    ui_msg_box("Error", conn.CallResult.text)
    end
end if
if .not. args.Set("country", country)
    conn.close()
    end
end if
if .not. conn.execute(sql, args)
    ui_msg_box("Error", conn.CallResult.text)
    conn.close()
    end
end if
rs = conn.ResultSet
if .not. rs.ToDBF("C:\Users\YOUR_USER_NAME\Documents\newtable.dbf", "", 3, 1 )
    ui_msg_box("Error", rs.CallResult.text)
end if
conn.close()

Limitations

Not supported on Community Edition